/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;


/**
 * <p>Project: jdbc - Jdbcdemo
 * <p>Powered by jiangbo On 2023-02-13
 * 10:45:34
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class Jdbcdemo {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");

        Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/zhao","root","123456");
        Statement st = conn.createStatement();
        String sql="select * from zhao ";
        ResultSet rs = st.executeQuery(sql);
        while(rs.next()){
            System.out.println(rs.getInt("id")+" "+rs.getString("name"));

        }
        conn.close();
        st.close();
        rs.close();


    }
}


